<template>
  <div class="app-container">
    <!-- 主体内容 -->
    <el-row style="background: #f5f7fa;height:100%" v-if="showcontent =='index'">
      <el-col :span="20" class="right-content">
        <!-- 待办事项 -->
        <el-row class="pending-matters">
          <el-col :span="24">
            <div class="title">
              <div>待办事项</div>
              <div class="update-time">更新时间：2022-12-31 14:25:25</div>
            </div>

            <el-row :gutter="20">
              <el-col :span="8" @click="todo">
                <div class="pending-card" @click="showcontent = 'representative'">
                  <div class="card-content">
                    <img src="../assets/images/info.png" alt />
                    <div class="caritem">
                      <div>待办事项</div>
                      <div class="count">5</div>
                    </div>
                  </div>
                </div>
              </el-col>
              <el-col :span="8">
                <div class="pending-card">
                  <div class="card-content" @click="showcontent = 'earlywarning'">
                    <img src="../assets/images/yj.png" alt />
                    <div class="caritem">
                      <span>预警事项</span>
                      <div class="count">3</div>
                    </div>
                  </div>
                </div>
              </el-col>
            </el-row>
          </el-col>
        </el-row>

        <!-- 授权管理 -->
        <el-row class="pending-matters">
          <el-col :span="24">
            <div class="title">
              <div>授权管理</div>
            </div>

            <el-row :gutter="20">
              <el-col :span="8" @click="todo">
                <div shadow="hover" class="pending-card" @click="open2 = true">
                  <div class="card-content">
                    <img src="../assets/images/sq.png" alt />
                    <div class="caritem">
                      <div>授权管理</div>
                    </div>
                  </div>
                </div>
              </el-col>
            </el-row>
          </el-col>
        </el-row>
      </el-col>
      <el-col :span="4">
        <!-- 右侧信息栏 -->
        <el-row class="right-sidebar">
          <el-col :span="24">
            <el-card class="info-card">
              <div class="title">
                <div class="t1">公告中心</div>
                <div class="t2">更多</div>
              </div>
              <div class="announcement" v-for="item in 5">
                <div class="text">EP采购升级改造...</div>
                <div class="time">12/31</div>
              </div>
            </el-card>
          </el-col>
          <el-col :span="24">
            <el-card class="info-card">
              <div class="title">用户信息</div>
              <div class="user-info">
                <img src="../assets/images/user.png" alt />
                <span>张三</span>
              </div>
              <div class="login-time">
                <span>登录时间</span>
                <span>2023-12-31 12:31:31</span>
              </div>
            </el-card>
          </el-col>
          <el-col :span="24">
            <el-card class="info-card">
              <div class="title">
                <div class="t1">内部通知</div>
                <div class="t2">更多</div>
              </div>
              <div class="announcement" v-for="item in 5">
                <div class="text">EP采购升级改造...</div>
                <div class="time">12/31</div>
              </div>
            </el-card>
          </el-col>
        </el-row>
      </el-col>
    </el-row>
    <el-row>
      <!-- //代办列表 -->
      <el-col :span="24" v-if="showcontent == 'representative'">
        <div class="tablebox">
          <div class="title-table">
            <span class="line"></span>
            <span>代办列表</span>
          </div>
          <el-form :model="queryParams" ref="queryForm" label-width="88px">
            <el-row :gutter="20" class="padding-search-area">
              <el-col :md="6" :sm="15">
                <el-form-item label="公司名称" prop="code">
                  <el-input
                    v-model="queryParams.code"
                    placeholder="请输入公司名称"
                    clearable
                    size="small"
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" :sm="15">
                <el-form-item label="项目名称" prop="name">
                  <el-input
                    v-model="queryParams.name"
                    placeholder="请输入项目名称"
                    clearable
                    size="small"
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>

              <el-col :md="6" :sm="15">
                <el-form-item label="采购类型" prop="latitude">
                  <el-input
                    v-model="queryParams.latitude"
                    placeholder="请输入采购类型"
                    clearable
                    size="small"
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" :sm="15">
                <el-form-item label="代办类型" prop="longitude">
                  <el-input
                    v-model="queryParams.longitude"
                    placeholder="请输入代办类型"
                    clearable
                    size="small"
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" :sm="15">
                <el-form-item label="申请部门" prop="longitude">
                  <el-input
                    v-model="queryParams.longitude"
                    placeholder="请输入申请部门"
                    clearable
                    size="small"
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" :sm="15">
                <el-form-item label="接受时间起" prop="longitude">
                  <el-input
                    v-model="queryParams.longitude"
                    placeholder="请输入接受时间起"
                    clearable
                    size="small"
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" :sm="15">
                <el-form-item label="接受时间止" prop="longitude">
                  <el-input
                    v-model="queryParams.longitude"
                    placeholder="请输入接受时间止"
                    clearable
                    size="small"
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
          <el-row :gutter="10">
            <el-col :span="1.5">
              <el-button type="primary" size="mini" @click="handleQuery">查询</el-button>
            </el-col>
            <el-col :span="1.5">
              <el-button size="mini" @click="resetQuery">重置</el-button>
            </el-col>
            <el-col :span="1.5">
              <el-button size="mini" @click="approve" type="warning">批量审批</el-button>
            </el-col>
          </el-row>
          <el-table
            :data="tableData"
            border
            style="width: 100%;margin-top:10px"
            @selection-change="handleSelectionChange"
          >
            <el-table-column type="selection" width="55" align="center" />
            <el-table-column type="index" width="50" label="序号" align="center"></el-table-column>
            <el-table-column prop="no" label="采购申请单号" width="180" align="center"></el-table-column>
            <el-table-column prop="name" label="RFQ编号" width="180" align="center"></el-table-column>
            <el-table-column prop="address" label="公司名称" align="center"></el-table-column>
            <el-table-column prop="address" label="申请部门" align="center"></el-table-column>
            <el-table-column prop="address" label="申请人" align="center"></el-table-column>
            <el-table-column prop="address" label="项目名称" align="center"></el-table-column>
            <el-table-column prop="address" label="采购类型" align="center"></el-table-column>
            <el-table-column prop="address" label="品类" align="center"></el-table-column>
            <el-table-column prop="address" label="代办事项" align="center"></el-table-column>
            <el-table-column prop="address" label="接受时间" align="center" width="180"></el-table-column>
            <el-table-column prop="address" label="计划时间" align="center" width="180"></el-table-column>
          </el-table>
          <div class="pagination-container">
            <el-pagination
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
              :current-page="4"
              :page-sizes="[100, 200, 300, 400]"
              :page-size="100"
              layout="total, sizes, prev, pager, next, jumper"
              :total="400"
            ></el-pagination>
          </div>
        </div>
      </el-col>
      <!-- //预警列表 -->
      <el-col :span="24" v-if="showcontent == 'earlywarning'">
        <div class="tablebox">
          <div class="title-table">
            <span class="line"></span>
            <span>预警列表</span>
          </div>
          <el-form :model="queryParams" ref="queryForm" label-width="88px">
            <el-row :gutter="20" class="padding-search-area">
              <el-col :md="6" :sm="15">
                <el-form-item label="公司名称" prop="code">
                  <el-input
                    v-model="queryParams.code"
                    placeholder="请输入公司名称"
                    clearable
                    size="small"
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" :sm="15">
                <el-form-item label="项目名称" prop="name">
                  <el-input
                    v-model="queryParams.name"
                    placeholder="请输入项目名称"
                    clearable
                    size="small"
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>

              <el-col :md="6" :sm="15">
                <el-form-item label="采购类型" prop="latitude">
                  <el-input
                    v-model="queryParams.latitude"
                    placeholder="请输入采购类型"
                    clearable
                    size="small"
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" :sm="15">
                <el-form-item label="代办类型" prop="longitude">
                  <el-input
                    v-model="queryParams.longitude"
                    placeholder="请输入代办类型"
                    clearable
                    size="small"
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" :sm="15">
                <el-form-item label="申请部门" prop="longitude">
                  <el-input
                    v-model="queryParams.longitude"
                    placeholder="请输入申请部门"
                    clearable
                    size="small"
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" :sm="15">
                <el-form-item label="接受时间起" prop="longitude">
                  <el-input
                    v-model="queryParams.longitude"
                    placeholder="请输入接受时间起"
                    clearable
                    size="small"
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" :sm="15">
                <el-form-item label="接受时间止" prop="longitude">
                  <el-input
                    v-model="queryParams.longitude"
                    placeholder="请输入接受时间止"
                    clearable
                    size="small"
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
          <el-row :gutter="10">
            <el-col :span="1.5">
              <el-button type="primary" size="mini" @click="handleQuery">查询</el-button>
            </el-col>
            <el-col :span="1.5">
              <el-button size="mini" @click="resetQuery">重置</el-button>
            </el-col>
            <el-col :span="1.5">
              <el-button size="mini" @click="approve" type="warning">批量审批</el-button>
            </el-col>
          </el-row>
          <el-table
            :data="tableData"
            border
            style="width: 100%;margin-top:10px"
            @selection-change="handleSelectionChange"
          >
            <el-table-column type="selection" width="55" align="center" />
            <el-table-column type="index" width="50" label="序号" align="center"></el-table-column>
            <el-table-column prop="no" label="采购申请单号" width="180" align="center"></el-table-column>
            <el-table-column prop="name" label="RFQ编号" width="180" align="center"></el-table-column>
            <el-table-column prop="address" label="公司名称" align="center"></el-table-column>
            <el-table-column prop="address" label="申请部门" align="center"></el-table-column>
            <el-table-column prop="address" label="申请人" align="center"></el-table-column>
            <el-table-column prop="address" label="项目名称" align="center"></el-table-column>
            <el-table-column prop="address" label="采购类型" align="center"></el-table-column>
            <el-table-column prop="address" label="品类" align="center"></el-table-column>
            <el-table-column prop="address" label="代办事项" align="center"></el-table-column>
            <el-table-column prop="address" label="接受时间" align="center" width="180"></el-table-column>
            <el-table-column prop="address" label="计划时间" align="center" width="180"></el-table-column>
          </el-table>
          <div class="pagination-container">
            <el-pagination
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
              :current-page="4"
              :page-sizes="[100, 200, 300, 400]"
              :page-size="100"
              layout="total, sizes, prev, pager, next, jumper"
              :total="400"
            ></el-pagination>
          </div>
        </div>
      </el-col>
    </el-row>
    <el-dialog title="批量审批" :visible.sync="open" width="30%" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="90px">
        <el-row>
          <el-col :span="24">
            <el-form-item label="审批意见" prop="code">
              <el-input
                v-model="form.code"
                placeholder="请输入审批意见"
                type="textarea"
                rows="2"
                show-word-limit
              />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog title="授权管理" :visible.sync="open2" width="30%" append-to-body>
      <el-form ref="form" :model="formAuthorize" :rules="rulesAuthorize" label-width="100px">
        <el-row>
          <el-col :span="24">
            <el-form-item label="被授权人" prop="code">
              <el-input v-model="formAuthorize.code" placeholder="请输入被授权人" show-word-limit />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="授权类别" prop="code">
              <el-input v-model="formAuthorize.code" placeholder="请输入授权类别" show-word-limit />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="授权开始时间" prop="code">
              <el-input v-model="formAuthorize.code" placeholder="请输入审批意见" show-word-limit />
            </el-form-item>
            <el-form-item label="授权结束时间" prop="code">
              <el-input v-model="formAuthorize.code" placeholder="请输入审批意见" show-word-limit />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="open2=false">取 消</el-button>
        <el-button type="primary" @click="open2=false">确 定</el-button>
        <el-button @click="open2=false">收 回</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: "Home",
  data() {
    return {
      showcontent: "index",
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 20
      },
      tableData: [
        {
          no: "12312312321"
        }
      ],
      form: {},
      rules: [],
      open: false,
      open2: false,
      formAuthorize: {},
      rulesAuthorize: {}
    };
  },
  methods: {
    approve() {
      this.open = true;
    },
    logout() {
      // 退出逻辑
      this.$message.success("退出成功");
    },
    todo() {},
    /** 查询装卸地列表 */
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    getList() {},
    submitForm() {
      this.open = false;
    },
    cancel() {
      this.open = false;
    }
  }
};
</script>

<style scoped lang="scss">
.app-container {
  /* width: calc(100% - 200px); */
  padding: 20px;
  background: #f5f7fa;
  flex: 1;
}
.headtitle {
  display: flex;
  align-items: center;
  background: #409eff;
  color: #fff;
  height: 60px;
  position: relative;
  .headtitle_left {
    width: 200px;
    height: 100%;
    border-right: solid 1px #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
  }
  .exitbox {
    position: absolute;
    right: 40px;
    top: 20px;
  }
}
.header {
  width: 100%;
  background: #409eff;
  color: #fff;
  .textTitle {
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
  }
}
.procurement-system {
  width: 100%;
  height: 100%;
}

.main-content {
  display: flex;
  height: calc(100vh - 60px);
}

.left-sidebar {
  width: 200px;
}

.left-menu {
  height: 100%;
}

.right-content {
  flex: 1;
}

.right-sidebar {
  padding: 20px;
  height: 100%;
}

.pending-matters,
.authorization-management {
  margin-bottom: 20px;
  background: #fff;
  padding: 20px;
}
.pending-matters,
.authorization-management {
  .title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    .update-time {
      font-size: 12px;
      color: #999;
      margin-left: 20px;
    }
  }
}

.pending-card,
.auth-card {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-card {
  .card-content {
  }
}

.card-content {
  display: flex;
  align-items: center;
  img {
    width: 80px;
    height: 80px;
  }
  .caritem {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    margin-left: 20px;
    .count {
      font-size: 30px;
      font-weight: bold;
      color: #409eff;
      text-decoration: underline;
    }
  }
}

.info-card {
  margin-bottom: 20px;
  .title {
    display: flex;
    justify-content: space-between;
    .t2 {
      color: #ccc;
      font-size: 14px;
    }
  }
  .announcement {
    display: flex;
    justify-content: space-between;
    font-size: 15px;
    margin-top: 10px;
  }
}

.user-info {
  display: flex;
  align-items: center;
  margin-top: 10px;
  img {
    width: 50px;
    height: 50px;
  }
}

.user-info span {
  margin-left: 10px;
}

.login-time {
  font-size: 15px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  span {
    margin-top: 5px;
  }
}

//
.tablebox {
  padding: 20px;
  .title-table {
    display: flex;
    align-items: center;
    .line {
      width: 5px;
      height: 20px;
      background-color: #409eff;
      margin-right: 10px;
    }
  }
}
.padding-search-area {
  padding: 10px;
}
.pagination-container {
  margin-top: 30px;
  display: flex;
  justify-content: flex-end;
}
.dialog-footer {
  display: flex;
  justify-content: center;
}
</style>